package leetcode.秋招.京东;

import java.util.Scanner;

/**
 * @author ：zsy
 * @date ：Created 2021/8/21 18:52
 * @description：
 */
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int[][] map = new int[N][2];
        for (int i = 0; i < map.length; i++) {
            map[i][0] = in.nextInt();
            map[i][1] = in.nextInt();
        }
        int count = 0;
        for (int i = 0; i < map.length; i++) {
            for (int j = i + 1; j < map.length; j++) {
                if (Math.abs(map[j][0] - map[i][0]) == Math.abs(map[j][1] - map[i][1])) {
                    count++;
                }
            }
        }
        System.out.println(count);
    }
}
